//
//  Function04_VC.m
//  Hwi_Library_Demo
//
//  Created by Jeonghwi Kim on 13. 7. 7..
//  Copyright (c) 2013년 KDML. All rights reserved.
//

#import "Function04_VC.h"


@implementation Function04_VC

- (IBAction)on_btn_back02_back:(id)sender
{
    [self.navigationController popViewControllerAnimated:YES];
}


- (BOOL)textFieldShouldReturn:(UITextField *)textField
{
    [self on_btn01_search_address:self];

    return YES;
}
- (IBAction)on_btn01_search_address:(id)sender
{
    [self.hwi hwi04_get_address_from_postoffice_with_string:self.textfield01_input_address.text and_postOffice_api_key:nil callback:self];
    [self.textfield01_input_address resignFirstResponder];    

}

-(void)hwi04_did_receive_postoffice_network:(NSMutableArray*)array_post_office_item
{
    self.array01_postoffice = array_post_office_item;
    [self.tableview01_postoffice reloadData];
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return self.array01_postoffice.count;
}


- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"CELL_POST_OFFICE"];
    Postoffice_item *item = [self.array01_postoffice objectAtIndex:indexPath.row];
    cell.textLabel.text =item.string01_post_cd;
    cell.detailTextLabel.text = item.string02_address;
    return cell;
}



- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    self.hwi = [Hwi get_instance];
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
